﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ObjectTransposeApi.Structure;

namespace ObjectTransposeApi.Handler.Property
{
    /// <summary/>
    internal class BooleanPropertyHandler : AbstractPropertyHandler
    {
        /// <summary/>
        internal override IEnumerable<QueueStructure> Process(PropertyStructure propertyStructure)
        {
            // is the destination property a boolean
            if (propertyStructure.DestinationPropertyInfo.PropertyType != typeof(bool))
            {
                return base._successor.Process(propertyStructure);
            }

            // set the destiantion property value to be true because a matching type was found
            propertyStructure.DestinationPropertyInfo.SetValue(propertyStructure.Destination, true, null);
            
            // nothing to return
            return null;
        }
    }
}
